1、机器人运动步数
思想：深度优先搜索；
、class Solution {
public:
    int next[4][2]={{1,0},{-1,0},{0,1},{0,-1}}; 
    int count=0;
    int sum(int n)
    {
        int ans=0;
        while(n)
        {
            ans+=(n%10);
            n=n/10;
        }
        return ans;
    }
    void dfs(int m, int n, int k,int curx,int cury,vector<vector<int>>& book)
    {
        count+=1;
        book[curx][cury]=1;
        for(int i=0;i<4;i++)
        {
            int newx=curx+next[i][0];
            int newy=cury+next[i][1];
            if(newx<0||newx>=m||newy<0||newy>=n||book[newx][newy]||sum(newx)+sum(newy)>k)
                continue;
            else
                dfs(m,n,k,newx,newy,book);
        }
    }
    int movingCount(int m, int n, int k) {
        vector<vector<int>> book(m,vector<int>(n,0));
        dfs(m,n,k,0,0,book);
        return count;
    }
};